<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>SetGadgetData</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">SetGadgetData()</font></b></p>
<p><b>Syntax</b></p><blockquote>
<font color="#006666"><b>SetGadgetData</b></font>(#Gadget, Value)</blockquote>

</blockquote>
<b>Description</b><br><blockquote>



Stores the given value with the specified gadget. This value can later be read with the <a href="getgadgetdata.html">GetGadgetData()</a> 
function. This allows to associate a custom value with any gadget. 

 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Gadget</i></td>
<td width="90%"> 
 
The gadget to use. 

 

</td></tr>
<tr><td><i>Value</i></td>
<td> 
 
The value to set. 

 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

None.





</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <font color="#006666">; This code uses SetGadgetData to associate an index for the Messages()</font>
  <font color="#006666">; array with each button. This makes the event loop simpler as not every</font>
  <font color="#006666">; gadget needs to he handled separately.</font>
  <font color="#006666">;</font>
  <b><font color="#006666">Dim</font></b> <font color="#006666">Messages</font>.s(2)
<font color="#006666">  Messages</font>(0) = "Good morning"
<font color="#006666">  Messages</font>(1) = "Hello World"
<font color="#006666">  Messages</font>(2) = "Nothing to say"
  <b><font color="#006666">If</font></b> <font color="#006666">OpenWindow</font>(0, 0, 0, 190, 100, "SetGadgetData", <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
<font color="#006666">    ButtonGadget</font>(0,  10, 10, 80, 20, "Button"):<font color="#006666"> SetGadgetData</font>(0, 1)
<font color="#006666">    ButtonGadget</font>(1,  10, 40, 80, 20, "Button"):<font color="#006666"> SetGadgetData</font>(1, 2)
<font color="#006666">    ButtonGadget</font>(2,  10, 70, 80, 20, "Button"):<font color="#006666"> SetGadgetData</font>(2, 1)
<font color="#006666">    ButtonGadget</font>(3, 100, 10, 80, 20, "Button"):<font color="#006666"> SetGadgetData</font>(3, 2)
<font color="#006666">    ButtonGadget</font>(4, 100, 40, 80, 20, "Button") <font color="#006666">; will have the value 0 because nothing was set yet</font>
<font color="#006666">    ButtonGadget</font>(5, 100, 70, 80, 20, "Button")
    <b><font color="#006666">Repeat</font></b>
      Event =<font color="#006666"> WaitWindowEvent</font>()
      <b><font color="#006666">If</font></b> Event = <font color="#924B72">#PB_Event_Gadget</font>
        Value =<font color="#006666"> GetGadgetData</font>(<font color="#006666">EventGadget</font>())
<font color="#006666">        MessageRequester</font>("Message",<font color="#006666"> Messages</font>(Value))
      <b><font color="#006666">EndIf</font></b>
    <b><font color="#006666">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#006666">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="getgadgetdata.html">GetGadgetData()</a>, <a href="getgadgetitemdata.html">GetGadgetItemData()</a>, <a href="setgadgetitemdata.html">SetGadgetItemData()</a> 

</Blockquote><p><b>Supported OS  </b><Blockquote>All</Blockquote></p><center>&lt;- <a href=setgadgetcolor.html>SetGadgetColor()</a> - <a href=index.html>Gadget Index</a> - <a href=setgadgetfont.html>SetGadgetFont()</a> -&gt;



</body></html>